/*!
 * LMV v6.4.1
 * 
 * Copyright 2019 Autodesk, Inc.
 * All rights reserved.
 * 
 * This computer source code and related instructions and comments are the
 * unpublished confidential and proprietary information of Autodesk, Inc.
 * and are protected under Federal copyright and state trade secret law.
 * They may not be disclosed to, copied or used by any third party without
 * the prior written consent of Autodesk, Inc.
 * 
 * Autodesk Forge Viewer Usage Limitations:
 * 
 * The Autodesk Forge viewer can only be used to view files generated by
 * Autodesk Forge services. The Autodesk Forge Viewer JavaScript must be
 * delivered from an Autodesk hosted URL.
 */
Autodesk.Extensions.ZoomWindow =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./extensions/ZoomWindow/ZoomWindow.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./extensions/ZoomWindow/ZoomWindow.css":
/*!**********************************************!*\
  !*** ./extensions/ZoomWindow/ZoomWindow.css ***!
  \**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(/*! !../../node_modules/css-loader!./ZoomWindow.css */ "./node_modules/css-loader/index.js!./extensions/ZoomWindow/ZoomWindow.css");

if(typeof content === 'string') content = [[module.i, content, '']];

var transform;
var insertInto;



var options = {"hmr":true}

options.transform = transform
options.insertInto = undefined;

var update = __webpack_require__(/*! ../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);

if(content.locals) module.exports = content.locals;

if(false) {}

/***/ }),

/***/ "./extensions/ZoomWindow/ZoomWindow.js":
/*!*********************************************!*\
  !*** ./extensions/ZoomWindow/ZoomWindow.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return ZoomWindow; });
/* harmony import */ var _ZoomWindowTool__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ZoomWindowTool */ "./extensions/ZoomWindow/ZoomWindowTool.js");
/* harmony import */ var _ZoomWindow_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ZoomWindow.css */ "./extensions/ZoomWindow/ZoomWindow.css");
/* harmony import */ var _ZoomWindow_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_ZoomWindow_css__WEBPACK_IMPORTED_MODULE_1__);
function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}



var av = Autodesk.Viewing;
var namespace = AutodeskNamespace('Autodesk.Viewing.Extensions.ZoomWindow');

 // IMPORTANT!!

/**
 * Extends the dolly (zoom) button on the toolbar with a tool for end users to specify
 *  a rectangular section for the camera to zoom into and adjust accordingly.
 * 
 * The extension id is: `Autodesk.Viewing.ZoomWindow`
 * 
 * @example
 *   viewer.loadExtension('Autodesk.Viewing.ZoomWindow')
 * 
 * @memberof Autodesk.Viewing.Extensions
 * @alias Autodesk.Viewing.Extensions.ZoomWindow
 * @see {@link Autodesk.Viewing.Extension} for common inherited methods.
 * @constructor
 */var
ZoomWindow = /*#__PURE__*/function (_av$Extension) {_inherits(ZoomWindow, _av$Extension);

  function ZoomWindow(viewer, options) {var _this;_classCallCheck(this, ZoomWindow);
    _this = _possibleConstructorReturn(this, _getPrototypeOf(ZoomWindow).call(this, viewer, options));

    Autodesk.Viewing.Extension.call(_assertThisInitialized(_assertThisInitialized(_this)), viewer, options);
    _this.createUIBound = function () {
      viewer.removeEventListener(av.TOOLBAR_CREATED_EVENT, this.createUIBound);
      this.createUI(this.viewer.getToolbar(false));
    }.bind(_assertThisInitialized(_assertThisInitialized(_this)));
    _this.name = 'zoomwindow';
    _this.modes = ['zoomwindow', 'dolly'];return _this;
  }_createClass(ZoomWindow, [{ key: "load", value: function load()

    {
      var viewer = this.viewer;

      // Init & Register tool
      this.tool = new _ZoomWindowTool__WEBPACK_IMPORTED_MODULE_0__["default"](viewer);
      viewer.toolController.registerTool(this.tool);

      // Add the ui to the viewer.
      this.createUI(viewer.getToolbar(false));
      return true;
    } }, { key: "createUI", value: function createUI(

    toolbar) {
      var navTools;
      if (!toolbar || !(navTools = toolbar.getControl(Autodesk.Viewing.TOOLBAR.NAVTOOLSID)) || !navTools.dollybutton) {
        // tool bars aren't built yet, wait until they are
        this.viewer.addEventListener(av.TOOLBAR_CREATED_EVENT, this.createUIBound);
        return;
      }

      var self = this;
      // remove default zoom tool
      navTools.removeControl(navTools.dollybutton.getId());
      this.defaultDollyButton = navTools.dollybutton;

      // add combo button for zoom tool
      this.zoomWindowToolButton = new Autodesk.Viewing.UI.ComboButton('toolbar-zoomTools');
      this.zoomWindowToolButton.setIcon('zoomwindowtoolicon-zoom-window');
      this.zoomWindowToolButton.setToolTip('Zoom window');
      this.createZoomSubmenu(this.zoomWindowToolButton);
      navTools.addControl(this.zoomWindowToolButton);

      // Escape hotkey to exit tool.
      //
      var hotkeys = [{
        keycodes: [Autodesk.Viewing.KeyCode.ESCAPE],
        onRelease: function onRelease() {
          if (self.zoomWindowToolButton.getState() === Autodesk.Viewing.UI.Button.State.ACTIVE) {
            self.viewer.setActiveNavigationTool();
            self.zoomWindowToolButton.setState(Autodesk.Viewing.UI.Button.State.INACTIVE);
          }
        } }];

      this.viewer.getHotkeyManager().pushHotkeys(this.escapeHotkeyId, hotkeys);
    } }, { key: "destroyUI", value: function destroyUI()

    {
      var viewer = this.viewer;
      var toolbar = viewer.getToolbar(false);
      if (toolbar) {
        var navTools = toolbar.getControl(Autodesk.Viewing.TOOLBAR.NAVTOOLSID);
        if (navTools) {
          if (this.zoomWindowToolButton) {
            this.zoomWindowToolButton.subMenu.removeEventListener(
            Autodesk.Viewing.UI.RadioButtonGroup.Event.ACTIVE_BUTTON_CHANGED,
            this.zoomWindowToolButton.subMenuActiveButtonChangedHandler(navTools));
            navTools.removeControl(this.zoomWindowToolButton.getId());
          }
          this.zoomWindowToolButton = null;
          // set back dolly button
          if (navTools.panbutton && this.defaultDollyButton) {
            navTools.addControl(this.defaultDollyButton);
          } else
          {
            this.defaultDollyButton = null;
          }
        }
      }
      viewer.getHotkeyManager().popHotkeys(this.escapeHotkeyId);
    } }, { key: "createZoomSubmenu", value: function createZoomSubmenu(


    parentButton) {

      var createNavToggler = function createNavToggler(self, button, name) {
        return function () {
          var state = button.getState();
          if (state === Autodesk.Viewing.UI.Button.State.INACTIVE) {
            self.activate(name);
            button.setState(Autodesk.Viewing.UI.Button.State.ACTIVE);
          } else if (state === Autodesk.Viewing.UI.Button.State.ACTIVE) {
            self.deactivate();
            button.setState(Autodesk.Viewing.UI.Button.State.INACTIVE);
          }
        };
      };

      var viewer = this.viewer;
      var toolbar = viewer.getToolbar(true);
      var navTools = toolbar.getControl(Autodesk.Viewing.TOOLBAR.NAVTOOLSID);

      // zoom window
      var zoomWindowToolBut = new Autodesk.Viewing.UI.Button('toolbar-zoomWindowTool');
      zoomWindowToolBut.setToolTip(Autodesk.Viewing.i18n.translate("Zoom window"));
      zoomWindowToolBut.setIcon('zoomwindowtoolicon-zoom-window');
      zoomWindowToolBut.onClick = createNavToggler(this, zoomWindowToolBut, 'zoomwindow');
      parentButton.addControl(zoomWindowToolBut);
      // zoom
      var dollyBut = new Autodesk.Viewing.UI.Button('toolbar-zoomTool');
      dollyBut.setToolTip('Zoom');
      dollyBut.setIcon('adsk-icon-zoom');
      dollyBut.onClick = createNavToggler(this, dollyBut, 'dolly');
      parentButton.addControl(dollyBut);
    } }, { key: "unload", value: function unload()

    {
      var viewer = this.viewer;
      if (viewer.getActiveNavigationTool() === "dolly" ||
      viewer.getActiveNavigationTool() === "zoomwindow") {
        viewer.setActiveNavigationTool();
      }
      // Remove the UI
      this.destroyUI();
      // Deregister tool
      viewer.toolController.deregisterTool(this.tool);
      this.tool = null;

      return true;
    } }, { key: "activate",

    /**
                             * Activates either ZoomWindow or dolly/zoom tool.
                             * 
                             * @param {string} [mode='zoomwindow'] - Either 'zoomwindow' or 'dolly'
                             * @memberof Autodesk.Viewing.Extensions.ZoomWindow
                             * @alias Autodesk.Viewing.Extensions.ZoomWindow#activate
                             */value: function activate(
    mode) {
      if (this.activeStatus && this.mode === mode) {
        return;
      }
      switch (mode) {
        default:
        case 'zoomwindow':
          this.viewer.setActiveNavigationTool('zoomwindow');
          this.mode = 'zoomwindow';
          break;
        case 'dolly':
          this.viewer.setActiveNavigationTool('dolly');
          this.mode = 'dolly';
          break;}

      this.activeStatus = true;
      return true;
    } }, { key: "deactivate",

    /**
                               * Deactivates the tool and resets the navigation tool.
                               * 
                               * @memberof Autodesk.Viewing.Extensions.ZoomWindow
                               * @alias Autodesk.Viewing.Extensions.ZoomWindow#deactivate
                               */value: function deactivate()
    {
      if (this.activeStatus) {
        this.viewer.setActiveNavigationTool();
        this.activeStatus = false;
      }
      return true;
    } }]);return ZoomWindow;}(av.Extension);



namespace.ZoomWindow = ZoomWindow;
Autodesk.Viewing.theExtensionManager.registerExtension('Autodesk.Viewing.ZoomWindow', ZoomWindow);

/***/ }),

/***/ "./extensions/ZoomWindow/ZoomWindowTool.js":
/*!*************************************************!*\
  !*** ./extensions/ZoomWindow/ZoomWindowTool.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return ZoomWindowTool; });
function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}

var _CROSS_MAX_WIDTH = 20;

/**
                            *
                            * @constructor
                            */var
ZoomWindowTool = /*#__PURE__*/function () {

  function ZoomWindowTool(viewer) {_classCallCheck(this, ZoomWindowTool);
    this._names = ["zoomwindow"];
    this._isActive = false;
    this._isDragging = false;
    this._mouseStart = new THREE.Vector3(0, 0, -10);
    this._mouseEnd = new THREE.Vector3(0, 0, -10);

    this.materialLine = null;
    this.lineGeom = null;
    this.crossGeomX = null;
    this.crossGeomY = null;

    this.rectGroup = null;
    this.viewer = viewer;
    this._camera = this.viewer.navigation.getCamera();
  }_createClass(ZoomWindowTool, [{ key: "isActive", value: function isActive()

    {
      return this._isActive;
    } }, { key: "getNames", value: function getNames()

    {
      return this._names;
    } }, { key: "getName", value: function getName()

    {
      return this._names[0];
    } }, { key: "onResize", value: function onResize()

    {
      this.rectGroup = null;
      var canvas = this.viewer.canvas;
      var canvasWidth = canvas.clientWidth;
      var canvasHeight = canvas.clientHeight;
      var camera = new THREE.OrthographicCamera(0, canvasWidth, 0, canvasHeight, 1, 1000);
      this.viewer.impl.overlayScenes["ZoomWindowRect"].camera = camera;
    } }, { key: "activate", value: function activate(

    name) {
      this._isActive = true;
      // predefine material for rect
      if (this.materialLine === null) {
        // for 2d file draw rectangle in black
        var rectColor = null;
        if (this.viewer.navigation.getIs2D()) {
          rectColor = new THREE.Color(0x000000);
        } else
        {
          rectColor = new THREE.Color(0xffffff);
        }
        this.materialLine = new THREE.LineBasicMaterial({
          color: rectColor,
          opacity: .6,
          linewidth: 1,
          depthTest: false,
          depthWrite: false });

        this.materialLine.doNotCut = true;
      }
      // create overlay scene, with orthographic Camera
      var canvas = this.viewer.canvas;
      var canvasWidth = canvas.clientWidth;
      var canvasHeight = canvas.clientHeight;
      var camera = new THREE.OrthographicCamera(0, canvasWidth, 0, canvasHeight, 1, 1000);

      this.viewer.impl.createOverlayScene("ZoomWindowRect", this.materialLine, this.materialLine, camera);
      this.onResizeBinded = this.onResize.bind(this);
      this.viewer.impl.api.addEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT, this.onResizeBinded);

      // ??? In zoom window tool, we let orbitDollyPanTool to handle
      // ??? pan and dolly. And also we need get correct cursor info
      // ??? in orbitDollyPanTool. But in 2D, orbitDollyPanTool's default
      // ??? cursor is pan, then we have no idea whether orbitDollyPanTool
      // ??? is handling the message.
      // ??? So set orbit tool as active tool when zoom window tool active.
      // ??? On deactive we need set back the correct active tool to orbitDollyPanTool
      var tool = this.viewer.toolController.getTool("dolly");
      tool.activate("orbit");
    } }, { key: "deactivate", value: function deactivate(

    name) {
      this.rectGroup = null;
      this.viewer.impl.removeOverlayScene("ZoomWindowRect");
      this._isActive = false;
      this._isDragging = false;
      this._mouseStart.set(0, 0, -10);
      this._mouseEnd.set(0, 0, -10);
      this.viewer.impl.api.removeEventListener(Autodesk.Viewing.VIEWER_RESIZE_EVENT, this.onResizeBinded);

      // ??? Refer to the comments in activate
      var tool = this.viewer.toolController.getTool("dolly");
      tool.deactivate("orbit");
    } }, { key: "getCursor", value: function getCursor()

    {
      var tool = this.viewer.toolController.getTool("dolly");
      var mode = tool.getTriggeredMode();
      switch (mode) {

        case "dolly":
          return "url(), auto";
        case "pan":
          return "url(), auto";}

      return "url(), auto";
    } }, { key: "handleGesture",

    /////////////////////////////////////////////////////////////////////////
    // Tool event handler callbacks - can use "this".
    value: function handleGesture(
    event)
    {
      switch (event.type) {

        case "dragstart":
          return this.handleButtonDown(event, 0);

        case "dragmove":
          return this.handleMouseMove(event);

        case "dragend":
          return this.handleButtonUp(event, 0);}

      return false;
    } }, { key: "handleSingleClick", value: function handleSingleClick(

    event, button) {
      return true;
    } }, { key: "startDrag", value: function startDrag(

    event) {
      if (this._isDragging === false) {
        // begin dragging
        this._isDragging = true;
        this._mouseStart.x = event.canvasX;
        this._mouseStart.y = event.canvasY;
        this._mouseEnd.x = event.canvasX;
        this._mouseEnd.y = event.canvasY;
        if (this.rectGroup === null) {
          this.lineGeom = new THREE.Geometry();
          // rectangle of zoom window
          this.lineGeom.vertices.push(
          this._mouseStart.clone(),
          this._mouseStart.clone(),
          this._mouseStart.clone(),
          this._mouseStart.clone(),
          this._mouseStart.clone());
          // cross for identify zoom window center.
          this.crossGeomX = new THREE.Geometry();
          this.crossGeomX.vertices.push(
          this._mouseStart.clone(),
          this._mouseStart.clone());
          this.crossGeomY = new THREE.Geometry();
          this.crossGeomY.vertices.push(
          this._mouseStart.clone(),
          this._mouseStart.clone());

          // add geom to group
          var line_mesh = new THREE.Line(this.lineGeom, this.materialLine, THREE.LineStrip);
          var line_cross_x = new THREE.Line(this.crossGeomX, this.materialLine, THREE.LineStrip);
          var line_cross_y = new THREE.Line(this.crossGeomY, this.materialLine, THREE.LineStrip);

          this.rectGroup = new THREE.Group();
          this.rectGroup.add(line_mesh);
          this.rectGroup.add(line_cross_x);
          this.rectGroup.add(line_cross_y);
        } else
        {
          this.lineGeom.vertices[0] = this._mouseStart.clone();
          this.lineGeom.vertices[1] = this._mouseStart.clone();
          this.lineGeom.vertices[2] = this._mouseStart.clone();
          this.lineGeom.vertices[3] = this._mouseStart.clone();
          this.lineGeom.vertices[4] = this._mouseStart.clone();

          this.crossGeomX.vertices[0] = this._mouseStart.clone();
          this.crossGeomX.vertices[1] = this._mouseStart.clone();
          this.crossGeomY.vertices[0] = this._mouseStart.clone();
          this.crossGeomY.vertices[1] = this._mouseStart.clone();


          this.crossGeomX.verticesNeedUpdate = true;
          this.crossGeomY.verticesNeedUpdate = true;
          this.lineGeom.verticesNeedUpdate = true;
        }
        this.viewer.impl.addOverlay("ZoomWindowRect", this.rectGroup);
      }
    } }, { key: "handleButtonDown", value: function handleButtonDown(

    event, button) {
      // only handle left button down
      if (button === 0) {
        this.startDrag(event);
        return true;
      }
      return false;
    } }, { key: "handleMouseMove", value: function handleMouseMove(

    event) {
      if (this.lineGeom && this._isDragging)
      {
        this._mouseEnd.x = event.canvasX;
        this._mouseEnd.y = event.canvasY;
        return true;
      }

      return false; // Eat all these so default tools don't screw with view
    } }, { key: "endDrag", value: function endDrag(

    event) {
      if (this._isDragging === true) {
        this.viewer.impl.removeOverlay("ZoomWindowRect", this.rectGroup);
        this._isDragging = false;

      }
    } }, { key: "handleButtonUp", value: function handleButtonUp(

    event, button) {
      if (button === 0)
      {
        this.endDrag();
        return true;
      }
      return false;
    } }, { key: "handleKeyDown", value: function handleKeyDown(

    event, keyCode) {
      return false;
    } }, { key: "handleKeyUp", value: function handleKeyUp(

    event, keyCode) {
      return false;
    } }, { key: "handleWheelInput", value: function handleWheelInput(

    delta) {
      return false;
    } }, { key: "handleSingleClick", value: function handleSingleClick(

    event, button) {
      return false;
    } }, { key: "handleDoubleClick", value: function handleDoubleClick(

    event, button) {
      return false;
    } }, { key: "handleSingleTap", value: function handleSingleTap(

    even) {
      return false;
    } }, { key: "handleDoubleTap", value: function handleDoubleTap(

    event) {
      return false;
    } }, { key: "handleBlur", value: function handleBlur(

    event) {
      return false;
    } }, { key: "update", value: function update()

    {
      //
      if (!this.isActive())
      return;

      if (this.lineGeom && this._isDragging) {
        // draw rectangle
        this.lineGeom.vertices[1].x = this._mouseStart.x;
        this.lineGeom.vertices[1].y = this._mouseEnd.y;
        this.lineGeom.vertices[2] = this._mouseEnd.clone();
        this.lineGeom.vertices[3].x = this._mouseEnd.x;
        this.lineGeom.vertices[3].y = this._mouseStart.y;
        this.lineGeom.vertices[4] = this.lineGeom.vertices[0];

        // draw cross
        var width = Math.abs(this._mouseEnd.x - this._mouseStart.x);
        var height = Math.abs(this._mouseEnd.y - this._mouseStart.y);
        var length = width > height ? height : width;
        if (length > _CROSS_MAX_WIDTH) {
          length = _CROSS_MAX_WIDTH;
        }
        var half_length = length * 0.5;

        var cross_center = [(this._mouseEnd.x + this._mouseStart.x) * 0.5,
        (this._mouseEnd.y + this._mouseStart.y) * 0.5];

        this.crossGeomX.vertices[0].x = cross_center[0] - half_length;
        this.crossGeomX.vertices[0].y = cross_center[1];
        this.crossGeomX.vertices[1].x = cross_center[0] + half_length;
        this.crossGeomX.vertices[1].y = cross_center[1];

        this.crossGeomY.vertices[0].x = cross_center[0];
        this.crossGeomY.vertices[0].y = cross_center[1] - half_length;
        this.crossGeomY.vertices[1].x = cross_center[0];
        this.crossGeomY.vertices[1].y = cross_center[1] + half_length;

        this.crossGeomX.verticesNeedUpdate = true;
        this.crossGeomY.verticesNeedUpdate = true;
        this.lineGeom.verticesNeedUpdate = true;
        // only redraw overlay
        this.viewer.impl.invalidate(false, false, true);
      } else
      {
        return this.zoomWindow();
      }

      return false;
    } }, { key: "getPivot", value: function getPivot(

    mouseX, mouseY, screenWidth, screenHeight, camera) {
      // Convert mouse coordinates to clip space (-1 to 1)
      mouseX = 2 * mouseX / screenWidth - 1;
      mouseY = 1 - 2 * mouseY / screenHeight;

      // Get the ray through mouseX, mouseY
      var start = new THREE.Vector3(mouseX, mouseY, -1);
      var dir = new THREE.Vector3(mouseX, mouseY, 1);
      start.unproject(camera);
      dir.unproject(camera);
      dir.sub(start);

      // Now project the ray onto the plane perpendicular to the view direction
      // that contains the camera target. To do this we solve these equations:
      // viewDir.dot(pivot) == viewDir.dot(target), because the pivot is in the plane of the target
      // pivot = start + t * dir for some t, because pivot is on the ray through mouseX, mouseY
      // The solution goes like this:
      // Substitute pivot from the second equation to the first
      // viewDir.dot(start + t * dir) == viewDir.dot(target)
      // Distribut dot()
      // viewDir.dot(start) + t * viewDir.dot(dir) == view.dot(target)
      // t = (viewDir.dot(target) - viewDir.dot(start)) / view.dot(dir)
      var eye = camera.position;
      var target = camera.target;
      var viewDir = target.clone().sub(eye).normalize();
      var t = (viewDir.dot(target) - viewDir.dot(start)) / viewDir.dot(dir);
      start.add(dir.multiplyScalar(t));
      return start;
    } }, { key: "queryMouseRaySceneIntersection", value: function queryMouseRaySceneIntersection(

    centerX, centerY) {
      if (this.viewer == null)
      return null;

      if (this.viewer.model == null)
      return null;

      if (this.viewer.model.is2d()) {
        return null;
      }

      var result = this.viewer.impl.hitTest(centerX, centerY, false);
      return result ? result.intersectPoint : null;
    } }, { key: "zoomWindow", value: function zoomWindow()

    {
      var camera = this._camera;
      var canvasWidth = this.viewer.canvas.clientWidth;
      var canvasHeight = this.viewer.canvas.clientHeight;
      var rectMinX = this._mouseStart.x;
      var rectMinY = this._mouseStart.y;
      var rectMaxX = this._mouseEnd.x;
      var rectMaxY = this._mouseEnd.y;

      var rectWidth = Math.abs(rectMaxX - rectMinX);
      var rectHeight = Math.abs(rectMaxY - rectMinY);
      if (rectWidth === 0 || rectHeight === 0) {
        return false;
      }

      this._mouseEnd.copy(this._mouseStart);

      if (this.viewer.navigation.getIs2D()) {
        var vpVec = {
          x: (rectMinX + rectMaxX) * 0.5,
          y: (rectMinY + rectMaxY) * 0.5 };


        // Pan to the center of the zoom window first.
        var distance = this.viewer.navigation.getEyeVector().length();
        var delta = this.viewer.impl.clientToViewport(vpVec.x, vpVec.y);
        var on = this.viewer.impl.clientToViewport(canvasWidth / 2, canvasHeight / 2);
        delta.subVectors(delta, on);
        this.viewer.navigation.panRelative(delta.x / 2, delta.y / 2, distance);

        // Get scale
        var scaleX = rectWidth / canvasWidth;
        var scaleY = rectHeight / canvasHeight;
        var scale = scaleX > scaleY ? scaleX : scaleY;

        // Dolly
        distance = this.viewer.navigation.getEyeVector().length();
        var dollyTarget = this.viewer.navigation.getWorldPoint(0.5, 0.5);
        this.viewer.navigation.dollyFromPoint(distance * (scale - 1), dollyTarget);

        return true;
      }

      // ??? Should pick with rect first but currently LMV doesn't support rectangle selection
      // ??? So, do hit test only
      var hit = false;
      var pivot = null;
      // if pick up nothing, try ray pick
      if (!hit) {
        var centerX = (rectMinX + rectMaxX) * 0.5;
        var centerY = (rectMinY + rectMaxY) * 0.5;
        pivot = this.queryMouseRaySceneIntersection(centerX, centerY);
        // if pick up nothing, set pivot as intersection point from screen ray to project plane.
        if (pivot === null) {
          pivot = this.getPivot(centerX, centerY, canvasWidth, canvasHeight, this._camera);
        }
      }

      // calculate the basis vectors for the camera frame
      var eye = camera.position;
      var viewDir = camera.target.clone().sub(eye);
      viewDir.normalize();

      // calculate z camera translation for pan and zoom
      var scaleFactor = Math.min(canvasWidth / rectWidth, canvasHeight / rectHeight);
      var distEye2Pivot = pivot.distanceTo(eye);
      var zoomDist = distEye2Pivot * 1 / scaleFactor;

      // Calculate the new eye. The pivot is the new target.
      viewDir.multiplyScalar(-zoomDist);
      viewDir.add(pivot);

      camera.position.set(viewDir.x, viewDir.y, viewDir.z);
      camera.target.set(pivot.x, pivot.y, pivot.z);
      camera.dirty = true;

      return true;
    } }]);return ZoomWindowTool;}();

/***/ }),

/***/ "./node_modules/css-loader/index.js!./extensions/ZoomWindow/ZoomWindow.css":
/*!************************************************************************!*\
  !*** ./node_modules/css-loader!./extensions/ZoomWindow/ZoomWindow.css ***!
  \************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(/*! ../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
// imports


// module
exports.push([module.i, "@font-face {\n    font-family: 'zoomwindowtool';\n    src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAWwAAsAAAAABWQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFKmNtYXAAAAFoAAAAVAAAAFQXVtKHZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAVQAAAFUGr5W0GhlYWQAAAMYAAAANgAAADYLLmLJaGhlYQAAA1AAAAAkAAAAJAevA8ZobXR4AAADdAAAABQAAAAUCgAAK2xvY2EAAAOIAAAADAAAAAwAKAC+bWF4cAAAA5QAAAAgAAAAIAAUAGVuYW1lAAADtAAAAdoAAAHawO5e5HBvc3QAAAWQAAAAIAAAACAAAwAAAAMDAAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QADwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkA//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAADgAr/74D7QOAABQAKAAsADAANAA5AD8AQwBIAE4AUgBXAF0AYgAABSIuAjU0PgIzMh4CFRQOAiMRIg4CFRQeAjMyPgI1NC4CEzcXBwEzESMnIRUhAyM1MxUhIzUzFTMnIzUzNSM1MxURIzUzFSMhIzUzBSM1MxUFIzUjNTMRIzUzFQKrP21QLy9QbT8+bVEuLlFtPixMOCEhOEwsK0w5ISE5TGg2eTb+1jw8YgEA/wBWqqr+1oAqVlYqKioqKoBWAoCqqv8AqqoCACpWgCoqKy9RbT4+bVEvL1FtPj5tUS8B/CE5TCsrTDkhITlMKytMOSH+ZjZ5NgHC/wCePP7zKyuAVdWrVaurASuAKysrKytVVSv+VaurAAEAAAABAAD/0i17Xw889QALBAAAAAAA1BEPRwAAAADUEQ9HAAD/vgPtA4AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAA+0AAQAAAAAAAAAAAAAAAAAAAAUEAAAAAAAAAAAAAAACAAAABAAAKwAAAAAACgAUAB4AqgABAAAABQBjAA4AAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4em9vbXdpbmRvd3Rvb2wAegBvAG8AbQB3AGkAbgBkAG8AdwB0AG8AbwBsVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwem9vbXdpbmRvd3Rvb2wAegBvAG8AbQB3AGkAbgBkAG8AdwB0AG8AbwBsem9vbXdpbmRvd3Rvb2wAegBvAG8AbQB3AGkAbgBkAG8AdwB0AG8AbwBsUmVndWxhcgBSAGUAZwB1AGwAYQByem9vbXdpbmRvd3Rvb2wAegBvAG8AbQB3AGkAbgBkAG8AdwB0AG8AbwBsRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==);\n    font-weight: normal;\n    font-style: normal;\n}\n\n.adsk-viewing-viewer [class^=\"zoomwindowtoolicon-\"], [class*=\" zoomwindowtoolicon-\"] {\n  /* use !important to prevent issues with browser extensions that change fonts */\n  font-family: 'zoomwindowtool' !important;\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  line-height: 1;\n\n  /* Better Font Rendering =========== */\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n.adsk-viewing-viewer .zoomwindowtoolicon-zoom-window:before {\n  content: \"\\E900\";\n}", ""]);

// exports


/***/ }),

/***/ "./node_modules/css-loader/lib/css-base.js":
/*!*************************************************!*\
  !*** ./node_modules/css-loader/lib/css-base.js ***!
  \*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
	var list = [];

	// return the list of modules as css string
	list.toString = function toString() {
		return this.map(function (item) {
			var content = cssWithMappingToString(item, useSourceMap);
			if(item[2]) {
				return "@media " + item[2] + "{" + content + "}";
			} else {
				return content;
			}
		}).join("");
	};

	// import a list of modules into the list
	list.i = function(modules, mediaQuery) {
		if(typeof modules === "string")
			modules = [[null, modules, ""]];
		var alreadyImportedModules = {};
		for(var i = 0; i < this.length; i++) {
			var id = this[i][0];
			if(typeof id === "number")
				alreadyImportedModules[id] = true;
		}
		for(i = 0; i < modules.length; i++) {
			var item = modules[i];
			// skip already imported module
			// this implementation is not 100% perfect for weird media query combinations
			//  when a module is imported multiple times with different media queries.
			//  I hope this will never occur (Hey this way we have smaller bundles)
			if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
				if(mediaQuery && !item[2]) {
					item[2] = mediaQuery;
				} else if(mediaQuery) {
					item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
				}
				list.push(item);
			}
		}
	};
	return list;
};

function cssWithMappingToString(item, useSourceMap) {
	var content = item[1] || '';
	var cssMapping = item[3];
	if (!cssMapping) {
		return content;
	}

	if (useSourceMap && typeof btoa === 'function') {
		var sourceMapping = toComment(cssMapping);
		var sourceURLs = cssMapping.sources.map(function (source) {
			return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
		});

		return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
	}

	return [content].join('\n');
}

// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
	// eslint-disable-next-line no-undef
	var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
	var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;

	return '/*# ' + data + ' */';
}


/***/ }),

/***/ "./node_modules/style-loader/lib/addStyles.js":
/*!****************************************************!*\
  !*** ./node_modules/style-loader/lib/addStyles.js ***!
  \****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/

var stylesInDom = {};

var	memoize = function (fn) {
	var memo;

	return function () {
		if (typeof memo === "undefined") memo = fn.apply(this, arguments);
		return memo;
	};
};

var isOldIE = memoize(function () {
	// Test for IE <= 9 as proposed by Browserhacks
	// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
	// Tests for existence of standard globals is to allow style-loader
	// to operate correctly into non-standard environments
	// @see https://github.com/webpack-contrib/style-loader/issues/177
	return window && document && document.all && !window.atob;
});

var getTarget = function (target, parent) {
  if (parent){
    return parent.querySelector(target);
  }
  return document.querySelector(target);
};

var getElement = (function (fn) {
	var memo = {};

	return function(target, parent) {
                // If passing function in options, then use it for resolve "head" element.
                // Useful for Shadow Root style i.e
                // {
                //   insertInto: function () { return document.querySelector("#foo").shadowRoot }
                // }
                if (typeof target === 'function') {
                        return target();
                }
                if (typeof memo[target] === "undefined") {
			var styleTarget = getTarget.call(this, target, parent);
			// Special case to return head of iframe instead of iframe itself
			if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
				try {
					// This will throw an exception if access to iframe is blocked
					// due to cross-origin restrictions
					styleTarget = styleTarget.contentDocument.head;
				} catch(e) {
					styleTarget = null;
				}
			}
			memo[target] = styleTarget;
		}
		return memo[target]
	};
})();

var singleton = null;
var	singletonCounter = 0;
var	stylesInsertedAtTop = [];

var	fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");

module.exports = function(list, options) {
	if (typeof DEBUG !== "undefined" && DEBUG) {
		if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
	}

	options = options || {};

	options.attrs = typeof options.attrs === "object" ? options.attrs : {};

	// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
	// tags it will allow on a page
	if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();

	// By default, add <style> tags to the <head> element
        if (!options.insertInto) options.insertInto = "head";

	// By default, add <style> tags to the bottom of the target
	if (!options.insertAt) options.insertAt = "bottom";

	var styles = listToStyles(list, options);

	addStylesToDom(styles, options);

	return function update (newList) {
		var mayRemove = [];

		for (var i = 0; i < styles.length; i++) {
			var item = styles[i];
			var domStyle = stylesInDom[item.id];

			domStyle.refs--;
			mayRemove.push(domStyle);
		}

		if(newList) {
			var newStyles = listToStyles(newList, options);
			addStylesToDom(newStyles, options);
		}

		for (var i = 0; i < mayRemove.length; i++) {
			var domStyle = mayRemove[i];

			if(domStyle.refs === 0) {
				for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();

				delete stylesInDom[domStyle.id];
			}
		}
	};
};

function addStylesToDom (styles, options) {
	for (var i = 0; i < styles.length; i++) {
		var item = styles[i];
		var domStyle = stylesInDom[item.id];

		if(domStyle) {
			domStyle.refs++;

			for(var j = 0; j < domStyle.parts.length; j++) {
				domStyle.parts[j](item.parts[j]);
			}

			for(; j < item.parts.length; j++) {
				domStyle.parts.push(addStyle(item.parts[j], options));
			}
		} else {
			var parts = [];

			for(var j = 0; j < item.parts.length; j++) {
				parts.push(addStyle(item.parts[j], options));
			}

			stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
		}
	}
}

function listToStyles (list, options) {
	var styles = [];
	var newStyles = {};

	for (var i = 0; i < list.length; i++) {
		var item = list[i];
		var id = options.base ? item[0] + options.base : item[0];
		var css = item[1];
		var media = item[2];
		var sourceMap = item[3];
		var part = {css: css, media: media, sourceMap: sourceMap};

		if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
		else newStyles[id].parts.push(part);
	}

	return styles;
}

function insertStyleElement (options, style) {
	var target = getElement(options.insertInto)

	if (!target) {
		throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
	}

	var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];

	if (options.insertAt === "top") {
		if (!lastStyleElementInsertedAtTop) {
			target.insertBefore(style, target.firstChild);
		} else if (lastStyleElementInsertedAtTop.nextSibling) {
			target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
		} else {
			target.appendChild(style);
		}
		stylesInsertedAtTop.push(style);
	} else if (options.insertAt === "bottom") {
		target.appendChild(style);
	} else if (typeof options.insertAt === "object" && options.insertAt.before) {
		var nextSibling = getElement(options.insertAt.before, target);
		target.insertBefore(style, nextSibling);
	} else {
		throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
	}
}

function removeStyleElement (style) {
	if (style.parentNode === null) return false;
	style.parentNode.removeChild(style);

	var idx = stylesInsertedAtTop.indexOf(style);
	if(idx >= 0) {
		stylesInsertedAtTop.splice(idx, 1);
	}
}

function createStyleElement (options) {
	var style = document.createElement("style");

	if(options.attrs.type === undefined) {
		options.attrs.type = "text/css";
	}

	if(options.attrs.nonce === undefined) {
		var nonce = getNonce();
		if (nonce) {
			options.attrs.nonce = nonce;
		}
	}

	addAttrs(style, options.attrs);
	insertStyleElement(options, style);

	return style;
}

function createLinkElement (options) {
	var link = document.createElement("link");

	if(options.attrs.type === undefined) {
		options.attrs.type = "text/css";
	}
	options.attrs.rel = "stylesheet";

	addAttrs(link, options.attrs);
	insertStyleElement(options, link);

	return link;
}

function addAttrs (el, attrs) {
	Object.keys(attrs).forEach(function (key) {
		el.setAttribute(key, attrs[key]);
	});
}

function getNonce() {
	if (false) {}

	return __webpack_require__.nc;
}

function addStyle (obj, options) {
	var style, update, remove, result;

	// If a transform function was defined, run it on the css
	if (options.transform && obj.css) {
	    result = typeof options.transform === 'function'
		 ? options.transform(obj.css) 
		 : options.transform.default(obj.css);

	    if (result) {
	    	// If transform returns a value, use that instead of the original css.
	    	// This allows running runtime transformations on the css.
	    	obj.css = result;
	    } else {
	    	// If the transform function returns a falsy value, don't add this css.
	    	// This allows conditional loading of css
	    	return function() {
	    		// noop
	    	};
	    }
	}

	if (options.singleton) {
		var styleIndex = singletonCounter++;

		style = singleton || (singleton = createStyleElement(options));

		update = applyToSingletonTag.bind(null, style, styleIndex, false);
		remove = applyToSingletonTag.bind(null, style, styleIndex, true);

	} else if (
		obj.sourceMap &&
		typeof URL === "function" &&
		typeof URL.createObjectURL === "function" &&
		typeof URL.revokeObjectURL === "function" &&
		typeof Blob === "function" &&
		typeof btoa === "function"
	) {
		style = createLinkElement(options);
		update = updateLink.bind(null, style, options);
		remove = function () {
			removeStyleElement(style);

			if(style.href) URL.revokeObjectURL(style.href);
		};
	} else {
		style = createStyleElement(options);
		update = applyToTag.bind(null, style);
		remove = function () {
			removeStyleElement(style);
		};
	}

	update(obj);

	return function updateStyle (newObj) {
		if (newObj) {
			if (
				newObj.css === obj.css &&
				newObj.media === obj.media &&
				newObj.sourceMap === obj.sourceMap
			) {
				return;
			}

			update(obj = newObj);
		} else {
			remove();
		}
	};
}

var replaceText = (function () {
	var textStore = [];

	return function (index, replacement) {
		textStore[index] = replacement;

		return textStore.filter(Boolean).join('\n');
	};
})();

function applyToSingletonTag (style, index, remove, obj) {
	var css = remove ? "" : obj.css;

	if (style.styleSheet) {
		style.styleSheet.cssText = replaceText(index, css);
	} else {
		var cssNode = document.createTextNode(css);
		var childNodes = style.childNodes;

		if (childNodes[index]) style.removeChild(childNodes[index]);

		if (childNodes.length) {
			style.insertBefore(cssNode, childNodes[index]);
		} else {
			style.appendChild(cssNode);
		}
	}
}

function applyToTag (style, obj) {
	var css = obj.css;
	var media = obj.media;

	if(media) {
		style.setAttribute("media", media)
	}

	if(style.styleSheet) {
		style.styleSheet.cssText = css;
	} else {
		while(style.firstChild) {
			style.removeChild(style.firstChild);
		}

		style.appendChild(document.createTextNode(css));
	}
}

function updateLink (link, options, obj) {
	var css = obj.css;
	var sourceMap = obj.sourceMap;

	/*
		If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
		and there is no publicPath defined then lets turn convertToAbsoluteUrls
		on by default.  Otherwise default to the convertToAbsoluteUrls option
		directly
	*/
	var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;

	if (options.convertToAbsoluteUrls || autoFixUrls) {
		css = fixUrls(css);
	}

	if (sourceMap) {
		// http://stackoverflow.com/a/26603875
		css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
	}

	var blob = new Blob([css], { type: "text/css" });

	var oldSrc = link.href;

	link.href = URL.createObjectURL(blob);

	if(oldSrc) URL.revokeObjectURL(oldSrc);
}


/***/ }),

/***/ "./node_modules/style-loader/lib/urls.js":
/*!***********************************************!*\
  !*** ./node_modules/style-loader/lib/urls.js ***!
  \***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {


/**
 * When source maps are enabled, `style-loader` uses a link element with a data-uri to
 * embed the css on the page. This breaks all relative urls because now they are relative to a
 * bundle instead of the current page.
 *
 * One solution is to only use full urls, but that may be impossible.
 *
 * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
 *
 * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
 *
 */

module.exports = function (css) {
  // get current location
  var location = typeof window !== "undefined" && window.location;

  if (!location) {
    throw new Error("fixUrls requires window.location");
  }

	// blank or null?
	if (!css || typeof css !== "string") {
	  return css;
  }

  var baseUrl = location.protocol + "//" + location.host;
  var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");

	// convert each url(...)
	/*
	This regular expression is just a way to recursively match brackets within
	a string.

	 /url\s*\(  = Match on the word "url" with any whitespace after it and then a parens
	   (  = Start a capturing group
	     (?:  = Start a non-capturing group
	         [^)(]  = Match anything that isn't a parentheses
	         |  = OR
	         \(  = Match a start parentheses
	             (?:  = Start another non-capturing groups
	                 [^)(]+  = Match anything that isn't a parentheses
	                 |  = OR
	                 \(  = Match a start parentheses
	                     [^)(]*  = Match anything that isn't a parentheses
	                 \)  = Match a end parentheses
	             )  = End Group
              *\) = Match anything and then a close parens
          )  = Close non-capturing group
          *  = Match anything
       )  = Close capturing group
	 \)  = Match a close parens

	 /gi  = Get all matches, not the first.  Be case insensitive.
	 */
	var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
		// strip quotes (if they exist)
		var unquotedOrigUrl = origUrl
			.trim()
			.replace(/^"(.*)"$/, function(o, $1){ return $1; })
			.replace(/^'(.*)'$/, function(o, $1){ return $1; });

		// already a full url? no change
		if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
		  return fullMatch;
		}

		// convert the url to a full url
		var newUrl;

		if (unquotedOrigUrl.indexOf("//") === 0) {
		  	//TODO: should we add protocol?
			newUrl = unquotedOrigUrl;
		} else if (unquotedOrigUrl.indexOf("/") === 0) {
			// path should be relative to the base url
			newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
		} else {
			// path should be relative to current directory
			newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
		}

		// send back the fixed url(...)
		return "url(" + JSON.stringify(newUrl) + ")";
	});

	// send back the fixed css
	return fixedCss;
};


/***/ })

/******/ });